ADDRESS 'MAILMANAGER' ; CALL ReadConfig() ; MM_ReadMsg MM.Area MM.Num MM.Msg ; IF Rc = 0 THEN DO ; MM.File.Count = 0 ; DO k = 0 FOR MM.SearchFile.count ; Found = Trasforma(MM.SearchFile.k) ; MM_SearchInStem MM.Msg.Text Resp '"'Found'"' STR ; DO i = 0 FOR Resp.Count ; Len = VERIFY(Resp.i,MM.SearchFile.k)-1 ; Part = RIGHT(Resp.i,LENGTH(Resp.i)-Len) ; Testo = UPPER(SUBWORD(Part,1,1)) ; MM_SearchInStem MM.File Resp Testo STR ; IF Resp.Count = 0 THEN MM_AddToStem 'MM.File' 'Testo' ; END ; END ; IF MM.File.Count = 0 THEN DO ; CALL Requester(MM.PrgName, 'Sorry, NO File Found!! (Message #'MM.Num' in area 'MM.Area') ', '_Ok') ; EXIT ; END ; MM_SortStem MM.File ; MM_MultiSelReq MM.File Resp '"Select a files"' STR ; IF Rc = 1 THEN EXIT ; MM_RequestFiles '"'MM.Msg.FromAddr'"' Resp ; END ; EXIT
CheckFile: PROCEDURE EXPOSE MM. ; PARSE ARG Name ; IF LENGTH(Name) = 4 THEN RETURN ; MM_SearchInStem MM.File Resp Name STR ; IF Resp.Count = 0 THEN DO ; MM_AddToStem MM.File 'Name' ; END ; RETURN
ReadConfig: PROCEDURE EXPOSE MM. ; MM.SearchFile.Count = 0 ; MM_ReadStem MM.PathCfg||'MM_FileRequest.Cfg' Config ; IF Rc ~= 0 THEN DO ; SAY '*** Error: Can not open config "'MM.PathCfg'MM_FileRequest.cfg"' ; EXIT 10 ; END ; DO l = 0 FOR Config.Count ; IF (LEFT(Config.l,1) ~= ';') & Config.l ~= '' THEN DO ; PARSE VAR Config.l Keyword Dato ; SELECT ; WHEN UPPER(Keyword) = '#SEARCHFILE' THEN DO ; Dato = RIGHT(Dato,LENGTH(Dato)-1) ; MM_AddToStem MM.SearchFile 'Dato' ; END ; OTHERWISE ; END ; END ; END ; MM_GetSysOp 'MM.SysOp' ; RETURN
Replace: PROCEDURE ; PARSE ARG String, New, Old ; DO WHILE INDEX(String, Old) ~= 0 ; INTERPRET "PARSE VAR String l '"Old"' r" ; String = l || New || r ; END ; RETURN String